package com.licheng.controller;

import com.licheng.pojo.Emp;
import com.licheng.pojo.LoginInfo;
import com.licheng.pojo.Result;
import com.licheng.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody Emp emp){
        LoginInfo lgif = loginService.login(emp);
        if(lgif != null) {
            return Result.success(lgif);
        } else return Result.error("账户或者密码错误");
    }
}
